<template>
  <div>
    <div class="class-time" style="">
      <p>{{ index + 1 }}</p>
      <span class="title">{{ classTime.title }}</span>
      <span class="place font-color">地点：{{ classTime.place }}</span>
      <span class="font-color">{{ time(classTime.startTime, '\xa0\xa0\xa0{y}.{m}.{d} {h}:{i}') + '-' + time(classTime.endTime, '{h}:{i}') }}</span>
    </div>
    <hr>
  </div>
</template>

<script>
import { parseTime } from '@/utils'

export default {
  name: 'ClassTimeInfo',
  props: {
    classTime: {
      required: true,
      type: Object
    },
    index: {
      required: true,
      type: Number
    }
  },
  // 返回格式的时间
  methods: {
    time(time, format) {
      return parseTime(time, format)
    }
  }
}
</script>

<style lang="scss" scoped>
//课程时间
.class-time {
  display: flex;
  align-items: center;
  margin-top: 25px;

  p {
    background-color: #eee;
    border-radius: 10px;
    width: 32px;
    color: #333;
    text-align: center;
    margin: 0 8px 0 0;
    height: 20px;
    line-height: 20px;
  }

  .title {
    font-size: 16px;
    font-weight: bold;
    width: 270px;
  }
  .font-color {
    color: #999;
  }
  .place {
    width: 200px;
  }
}
</style>
